﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mogre;

namespace WastedMechanics.NavMesh
{
    public class Edge
    {
        public Vertex Begin;
        public Vertex End;        
        public List<Polygon> Polygons;

        public Edge(Vertex beg, Vertex end)
        {
            Polygons = new List<Polygon>();
            Begin = beg;
            End = end;
        }

        public void Visualize()
        {
            ManualObject manOb = Engine.SceneManager.CreateManualObject();
            manOb.Begin("Debug/HardRed", RenderOperation.OperationTypes.OT_LINE_LIST);

            manOb.Position(Begin.Position + new Vector3(0, 0.1f, 0));
            manOb.Position(End.Position + new Vector3(0, 0.1f, 0));

            manOb.End();

            SceneNode moNode = Engine.SceneManager.RootSceneNode.CreateChildSceneNode();
            moNode.Position = Vector3.ZERO;
            moNode.AttachObject(manOb);
        }

        public Vector3 Center
        {
            get { return (Begin.Position + End.Position) * 0.5f; }
        }
    }
}
